/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.bc;

import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.general.be.HistorialConexion;

/**
 *
 * @author ADMINISTRADOR
 */
public class HistorialConexionDelegate {

    private HistorialConexionFacadeLocal local;

    public HistorialConexionDelegate() {

        local = lookupHistorialConexionFacadeLocal();
    }

    public void create(HistorialConexion historialConexion){

        local.create(historialConexion);
    }

    public void edit(HistorialConexion historialConexion){

        local.edit(historialConexion);
    }

    public void remove(HistorialConexion historialConexion){

        local.remove(historialConexion);
    }

    public HistorialConexion find(Object id){

        return local.find(id);
    }

    public List<HistorialConexion> findAll(){

        return local.findAll();

    }

    public List<HistorialConexion> listaPorHistorialPorFechas(Date fecha1, Date fecha2){

        return local.listaPorFechas(fecha1, fecha2);

    }


    private HistorialConexionFacadeLocal lookupHistorialConexionFacadeLocal() {
        try {
            Context c = new InitialContext();
            return (HistorialConexionFacadeLocal) c.lookup("java:comp/env/HistorialConexionFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
